let decision;
while (decision !== "A" && decision !== "B" && decision !== "C") {
  decision = prompt(
    "Now, I want you to choose a type of geometric figure: \n A.rectangle \n B.right triangle \n C.rhombus"
  );
}

let chang;
  while (!chang || chang >= 10 || chang <= 0) {
    chang = prompt("tell me the length of your figure.(<=10)");
  }

let element = ''
while (element.length != 1) {
  element = prompt(
    "Then, you can choose the element of the geometric figure."
  );
}



  function drawline(eleNumb, spaBefor) {
    let hang='';
    //console.log(eleNumb)
    for(a = 0; a < eleNumb; a++){
     hang += element
    }
    for(b = 0; b < spaBefor; b++){
      hang = ' ' + hang
    }
   
    //console.log(hang)
    return hang+'\n'
  }
  
  function figuring (lie,x,y){
    let figur = ""
    for(d = 0; d < lie; d++ ){ figur += drawline(x,y)
   } return figur
  }

  function drawRectangle(lie){
    let figur = ""
    for(d = 0; d < lie; d++ ){ figur += drawline(chang,0)} 
    return figur
  }
  
  function drawTriangle(lie){
    let figur = ""
    for(d = 0; d < lie; d++ ){ figur += drawline(d+1,0)} 
    return figur
  }

  function drawRhombus(lie){
    let figur = ""
    for(d = 0; d < lie; d++){figur += drawline(d+1,chang-d)}
    for(d = lie; d > 0; d--){figur += drawline(d-1,chang-d+2)}
    return figur
  }
  if (decision == "A") {
 
   alert( drawRectangle(chang));
  }

  if (decision == "B") {
    alert(drawTriangle(chang))
  }
  if (decision == "C") {
    alert(drawRhombus(chang))
  }